package com.wsl.demo;

import cn.org.atool.generator.FileGenerator;
import cn.org.atool.generator.annotation.Table;
import cn.org.atool.generator.annotation.Tables;
import org.junit.Test;

public class Generator {
    public static final String url = "jdbc:mysql://49.233.3.126:3306/demo?useUnicode=true&characterEncoding=utf8";


    @Test
    public void generate() throws Exception {
        FileGenerator.build(Empty.class);
    }

    @Tables(
            // 设置数据库连接信息
            url = url, username = "root", password = "123456",
            // 设置entity类生成src目录, 相对于 user.dir
            srcDir = "src/main/java",
            // 设置entity类的package值
            basePack = "com.wsl.demo.user",
            // 设置dao接口和实现的src目录, 相对于 user.dir
            daoDir = "src/main/java",
            //去除表前缀
            tablePrefix = "",
            //逻辑删除字段
            logicDeleted = "del_flag",
            //乐观锁
            version = "version",
            //按字母排序 default=true
            alphabetOrder = false,
            // 设置哪些表要生成Entity文件
            tables = {@Table(value = {"user"})}
    )
    static class Empty {
    }
}
